<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var deleteDuplicates =function(head){
    let cur = head
    while(cur && cur.next){
    if(cur.val == cur.next.val){
        cur.next= cur.next.next
    }else {
        cur = cur.next
    }}
    return head
}
const head=[1,1,1]
console.log(deleteDuplicates(head));





    </script>
</body>
</html>